package chenji.yourinventory.wheel;

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;

import chenji.yourinventory.Main;
import chenji.yourinventory.inventory.InventoryManager.InventoryManagerType;

public class InventoryBuilder {
	private InventoryManagerType type;
	private Player p;
	private Inventory inv;

	public InventoryBuilder(final Player p, final InventoryManagerType type, final String title, final InventoryType invtype, int size) {
		this.p = p;
		this.type = type;
		this.inv = Bukkit.createInventory(p, invtype);
		if (invtype.equals(InventoryType.CHEST)) {
			inv.setMaxStackSize(size * 9);
		}
	}

	public Player getPlayer() {
		return this.p;
	}

	public InventoryManagerType getType() {
		return this.type;
	}

	public void openInventory() {
		p.closeInventory();
		Main.getInventoryManager().openInventory(p, type);
	}

}
